# a = 1.233444
# b = round(a, 3)
# print(b)


# import sys
# sys.setrecursionlimit(10000)  设置最大循环次数

# def add(x, y):
#     return x + y
#
#
# c = add(12, 4)
# print(c)
#
#
# def damage(skill1, skill2=2):
#     damage1 = skill1 * 3
#     damage2 = skill2 + 3
#
#     return damage1, damage2
#
#
# damages = damage(3, 5)  # 不建议使用这种方式
# print(type(damages))
#
# skill_damage1, skill_damage2 = damage(3, 5)
#
# print(skill_damage1, skill_damage2)

# 序列解包
# a, b, c = 1, 2, 3
# d = 1, 2, 3
# print(type(d))
# a, b, c = d

# a = b = c = 1
#
# damage(skill1=3)  # 指定参数传参，可以不用按照顺序传递


# 可变参数
# def calc(*numbers):
#     sum = 0
#     for n in numbers:
#         sum = sum + n * n
#     return sum


# print(calc([1, 2, 3]))

# print(calc(1, 2, 3))

# nums = [1, 2, 3, 4]
# print(calc(*nums))
# print(calc())


# 关键字参数
# def person(name, age, **kw):
#     print("name ", name, "age: ", age, "other: ", kw)
#
#
# person("mingming", 12)
#
# person("haha", 20, city="beijing")
#
# extra = {'city': 'beijing', 'job': 'it'}
#
# person('ye', 33, **extra)

# 命名关键字
# def person(name, age, *, city):
#     global a
#     a = 1
#     print(name, age, city)
#
#
# person('nana', 12, city='beijing')

# print(globals())
# print(locals())

# print(a)

# 作用域链
x = 1
def heihei():
    x = 'h'
    def inner():
        x = 'il'
        def inner2():
            print(x)
        inner2()
    inner()
heihei()